package cn.aishua.data;

import android.os.Parcel;
import android.os.Parcelable;

import com.baidu.mapapi.GeoPoint;
import com.baidu.mapapi.OverlayItem;

/**
 * Used in Map, contain vendor info(vendor name, category, average price, rate)
 * 
 * @author tonggton
 * 
 */
public class PopupItem
    extends OverlayItem
    implements Parcelable
{

    public static final Creator<PopupItem> CREATOR = new Creator<PopupItem>()
    {

        public PopupItem createFromParcel( Parcel src )
        {
            return new PopupItem( src.readInt(), src.readString(), src.readString(), src.readString(),
                src.readString(), src.readString(), src.readDouble(), src.readDouble() );
        }

        public PopupItem[] newArray( int size )
        {
            return new PopupItem[size];
        }
    };

    private int vendorId;
    private String vendorName;
    private String category;
    private String subCate;
    private String averagePrice;
    private String rate;
    private double x;
    private double y;

    public PopupItem(int vendorId, String vendorName, String category, String subCate, String averagePrice,
        String rate, double x, double y)
    {
        super( new GeoPoint( (int) ( x * 1e6 ), (int) ( y * 1e6 ) ), vendorName, averagePrice );
        this.vendorId = vendorId;
        this.vendorName = vendorName;
        this.category = category;
        this.subCate = subCate;
        this.averagePrice = averagePrice;
        this.rate = rate;
        this.x = x;
        this.y = y;
    }

    public void writeToParcel( Parcel dest, int flags )
    {
        dest.writeInt( vendorId );
        dest.writeString( vendorName );
        dest.writeString( category );
        dest.writeString( subCate );
        dest.writeString( averagePrice );
        dest.writeString( rate );
        dest.writeDouble( x );
        dest.writeDouble( y );
    }

    public int describeContents()
    {
        return 0;
    }

    public int getVendorId()
    {
        return vendorId;
    }

    public void setVendorId( int vendorId )
    {
        this.vendorId = vendorId;
    }

    public String getVendorName()
    {
        return vendorName;
    }

    public void setVendorName( String vendorName )
    {
        this.vendorName = vendorName;
    }

    public String getCategory()
    {
        return category;
    }

    public void setCategory( String category )
    {
        this.category = category;
    }

    public String getSubCate()
    {
        return subCate;
    }

    public void setSubCate( String subCate )
    {
        this.subCate = subCate;
    }

    public String getAveragePrice()
    {
        return averagePrice;
    }

    public void setAveragePrice( String averagePrice )
    {
        this.averagePrice = averagePrice;
    }

    public String getRate()
    {
        return rate;
    }

    public void setRate( String rate )
    {
        this.rate = rate;
    }

    public double getX()
    {
        return x;
    }

    public void setX( double x )
    {
        this.x = x;
    }

    public double getY()
    {
        return y;
    }

    public void setY( double y )
    {
        this.y = y;
    }

}
